#include "CWorker.h"
#include <QDebug>

CWorker::CWorker(QObject *parent) : QObject(parent)
{

}

void CWorker::slotCreateObjects()
{
    m_bezier = new CBezier;

    connect(m_bezier, &CBezier::signalSendTwoBezierPoint,   this, &CWorker::signalSendTwoOrderBezierPoint);
    connect(m_bezier, &CBezier::signalSendThreeBezierPoint, this, &CWorker::signalSendThreeOrderBezierPoint);
    connect(m_bezier, &CBezier::signalTwoOrderRollLine,     this, &CWorker::signalTwoOrderRollLine);
    connect(m_bezier, &CBezier::signalThreeOrderRollLine,   this, &CWorker::signalThreeOrderRollLine);
}

void CWorker::slotFitting(quint8 order, QVector<QPoint> points)
{
    qDebug("slotFitting, %d, %d\n", order, points.size());
    m_bezier->setBezierOrder(order);
    m_bezier->setBezierPoints(points);
    m_bezier->bezierFitting();
}
